<?php
/**
 * In this File the class '\UF\IO\Exception' is defined.
 *
 * @category   UniKap-Framework
 * @package    Exceptions
 * @author     Ulf -UniKado- Kadner <ulfikado@gmail.com>
 * @since      2014-03-29 16:17
 * @version    0.1
 */

namespace UF\IO
{

    /**
     * This is the base IO exception. All other IO exceptions extends from here.
     *
     * @since  v0.1
     */
    class Exception extends \UF\Exception
    {

        # <editor-fold defaultstate="collapsed" desc="- - - -   P R I V A T E   F I E L D S   - - - - - - - - - - - - - - - - - - - - -">

        private $path;

        # </editor-fold>

        # <editor-fold defaultstate="collapsed" desc="- - - >   C O N S T R U C T O R   - - - - - - - - - - - - - - - - - - - - - - - -">

        /**
         * Inits a new instance.
         *
         * @param  string     $path The Path (file or folder)
         * @param  string     $message THe optional error message
         * @param  int        $code A Optional Error code (Default to \E_USER_ERROR)
         * @param  \Exception $previous A optional previos exception
         * @since  v0.1
         */
        public function __construct( $path, $message = null, $code = \E_USER_ERROR, \Exception $previous = null )
        {
            parent::__construct(
                \UF\_1( '_io', 'There was a error for usage of path [%s]!', $path ) .
                ( empty( $message ) ? '' : ( "\n" . $message ) ),
                \is_null($code) ? \E_USER_ERROR : $code, $previous );
            $this->path = $path;
        }

        # </editor-fold>

        # <editor-fold defaultstate="collapsed" desc="- - - -   P U B L I C   M E T H O D S   - - - - - - - - - - - - - - - - - - - - -">

        /**
         * Returns the path (file or folder)
         *
         * @return string
         * @since  v0.1
         */
        public function getPath()
        {
            return $this->path;
        }

        # </editor-fold>

    }

}

